#include<vector>
#include<unordered_map>
using namespace std;

int totalFruit(vector<int>& fruits) {
    unordered_map<int, int> hash;
    int ret = 0;
    for (int left = 0, right = 0; right < fruits.size(); right++)
    {
        hash[fruits[right]]++;
        while (hash.size() > 2)
        {
            if (--hash[fruits[left]] == 0) hash.erase(fruits[left]);
            left++;
        }
        ret = max(ret, right - left + 1);
    }
    return ret;
}

int main()
{


	return 0;
}